<template>
  <div>
    <header class="header">
      <h1>todos</h1>
      <input v-model="name" @keydown.enter="add" class="new-todo" placeholder="请输入任务名称" autofocus />
    </header>
  </div>
</template>

<script>
export default {
  name: "VueTestTodoHeader",

  data() {
    return {
      name:''
    };
  },

  methods: {
    add(){
      this.$emit('addName', this.name);
      this.name=''
    }
  },
};
</script>

<style scoped>
</style>